package com.vitabuybuy.tv.ui.mine.account

import android.os.Bundle
import android.view.View
import androidx.core.os.bundleOf
import com.library.common.base.BaseActivity
import com.library.common.ext.setOnclickNoRepeat
import com.vitabuybuy.tv.R
import com.vitabuybuy.tv.databinding.ActivityAccountManagementBinding
import com.vitabuybuy.tv.ui.viewmodel.NoViewModel
import com.vitabuybuy.tv.ui.auth.BindEmailActivity
import com.vitabuybuy.tv.ui.auth.FindPasswordActivity
import kotlinx.android.synthetic.main.activity_account_management.*

class AccountManageActivity : BaseActivity<NoViewModel, ActivityAccountManagementBinding>(){
    override val isUseBaseTitleBar: Boolean
        get() = true
    override val layoutId: Int
        get() = R.layout.activity_account_management

    override fun initView(savedInstanceState: Bundle?) {
        setTitle(getString(R.string.account_management))
    }


    override fun eventHandling() {
        setOnclickNoRepeat(rlChangePassword, rlChangePhone, rlChangeEmail){v->
            when (v) {
                rlChangePassword ->FindPasswordActivity.openActivity(mContext,FindPasswordActivity.RESET_PWD)
                rlChangePhone -> SmsVerifyActivity.openActivity(mContext)
                rlChangeEmail -> BindEmailActivity.openActivity(mContext,
                    bundleOf(Pair("from", BindEmailActivity.FROM_BIND_EMAIL))
                )
            }
        }
    }
    companion object {
        fun openActivity(mContext: BaseActivity<*, *>) {
            mContext.startActivity(null, AccountManageActivity::class.java)
        }
    }
}
